Objects
Подкатегории
Функции
- dialog_obj
- get_flags
- get_object_ai_data
- get_object_data
- loot_obj
- obj_under_cursor
- real_dude_obj
- set_drugs_data
- set_dude_obj
- set_flags
- set_object_data
- set_self
- set_unique_id
dialog_obj
funcX
ObjectPtr dialog_obj()
Returns a pointer to the object (critter) the player is having a conversation or bartering with.
get_flags
funcX
int get_flags(ObjectPtr obj)
Gets the current value of object flags (see define_extra.h
for available flags).
get_object_ai_data
funcX
int get_object_ai_data(ObjectPtr object, int aiParam)
Returns the setting value from the AI packet of an object (critter). Use AI_CAP_*
constants from define_extra.h
for the aiParam
argument to get AI value.
get_object_data
funcX
get_object_data(ObjectPtr object, int offset)
Returns the data at the specified offset of an object (see OBJ_DATA_*
constants in define_extra.h
for offsets).
loot_obj
funcX
ObjectPtr loot_obj()
Returns a pointer to the target object (container or critter) of the loot screen.
obj_under_cursor
funcX
ObjectPtr obj_under_cursor(bool onlyCritter, bool includeDude)
Returns the object under the cursor on the main game screen.
- onlyCritter:
- True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
- False - checks all objects (can’t check critters under objects)
- passing False to the includeDude argument will ignore dude_obj
- NOTE: to get an object located on a tile when the cursor is in movement mode (hexagon cursor), use the
tile_under_cursor
function
- NOTE: to get an object located on a tile when the cursor is in movement mode (hexagon cursor), use the
real_dude_obj
funcX
ObjectPtr real_dude_obj()
Returns the initial dude_obj
after set_dude_obj
was used.
set_drugs_data
funcX
void set_drugs_data(int type, int pid, int value)
Overrides the parameters of drugs set in the configuration file (DrugsFile
setting in ddraw.ini
). Type: 0 - changes the value of NumEffects
for the drug (see Drugs.ini
for the description of NumEffects
), 1 - changes the duration of the addiction effect for the drug (a value of 1 = one game minute).
set_dude_obj
funcX
void set_dude_obj(ObjectPtr critter)
Take control of a given critter. Passing value 0 will reset control back to “real” dude.
set_flags
funcX
void set_flags(ObjectPtr obj, int flags)
Sets the current flags of an object. All flags are rewritten with given integer, so first get current flags with get_flags
and use bwor/bwand
to set/remove specific flag.
set_object_data
funcX
set_object_data(ObjectPtr object, int offset, int data)
Sets the data at the specified offset of an object.
set_self
void set_self(ObjectPtr)
Overrides the script’s self_obj
for the next function call.
- It is primarily used to allow the calling of functions which take an implicit
self_obj
parameter (e.g.drop_obj
) from global scripts, but it can also be used from normal scripts. - Will revert back to its original value after the next function call.
- Calling
self_obj(0)
will also revertself_obj
to original value. It is recommended to call this after each use ofset_self
in normal scripts in order to avoid unforeseen side effects. source_obj
,target_obj
, and similar functions will not work if preceded byset_self
.- NOTE: for
use_obj
,use_obj_on_obj
vanilla functions to work correctly, it is required to callset_self
twice.
set_unique_id
funcX
int set_unique_id(ObjectPtr object, int flag)
Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag
is optional.
- items with unique IDs will not stack with other items of the same type in the inventory
- to just get the current ID number of an object, use
get_object_data(object, OBJ_DATA_ID)
- unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF
- there is also a unique ID number range for the player and party members from 18000 to 83535
- to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument